package com.showgood.beans.handler;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.showgood.beans.proxy.PushProxy;
import com.showgood.socket.Session;
import com.showgood.util.SangoConst;
import com.showgood.vo.BaseVO;

public abstract class ArrayVoArrayReplyHandler<T> extends AbstractArrayVoHandler implements IArrayVoHandler<T> {
	
	@Autowired
	private PushProxy pushProxy; 

	@Override
	public int execute(Session userSession, int message, int stamp, List<T> vo) {
		List<BaseVO> data = handle(userSession, vo);
		if (data != null && data.size() > 0) {
			pushProxy.push(userSession, message, stamp, data);
		}
		return SangoConst.OK;
	}

	protected abstract List<BaseVO> handle(Session userSession, List<T> data);
}

